import React from 'react';
import { View, Text, Button, StatusBar, SafeAreaView } from 'react-native';

export default class Home extends React.Component {
  render() {
    const { navigation } = this.props;
    const msg = navigation.getParam('msg', 'NO-MSG');
    const itemId = navigation.getParam('itemId', 'NO-ID');
    return (
      <SafeAreaView style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: '#ecf0f1' }}>
        <StatusBar barStyle='dark-content' backgroundColor='#ecf0f1' />
        <Text>Home Screen</Text>
        <Text>itemId: {JSON.stringify(itemId)}</Text>
        <Text>msg: {JSON.stringify(msg)}</Text>
        <Button
          title='Go to Details'
          onPress={() => {
            /* 1. Navigate to the Details route with params */
            this.props.navigation.navigate('Details', {
              itemId     : 86,
              otherParam : 'anything you want here'
            });
          }}
        />
      </SafeAreaView>
    );
  }
}
